feat: 补齐测试缺失实现并接入 GitHub Actions CI#8
Merged
Merged
Conversation
## 变更内容 ### 修复测试编译错误 - main_test.go: 新增 runCLI 函数和 dispatchService 接口,使 CLI 逻辑可独立测试 - loop_judge_test.go / coverage_test.go: 补齐价值评估员相关类型与函数 - runner_test.go: 引入 execCommandContext 可替换别名,支持命令执行器注入 - config_test.go: 新增 LoopJudgeAgent 字段及默认常量 ### 生产代码补全 - agent: 新增 TaskKindLoopJudge 任务阶段 - config: 新增 LoopJudgeAgent / LoopJudgeStartRound / MaxCodingReviewRounds 字段 - pipeline/contracts: 新增 LoopJudgeResult 结构与 loadLoopJudgeResult 校验 - pipeline/dispatch: 新增 Runner 接口解耦 Service 与具体实现;接入价值评估员到 coder-reviewer loop;新增 shouldRunLoopJudge / runLoopJudgeRound - pipeline/artifacts: 新增逐轮工件路径方法 (EnsureRoundDir / CodingResultPathForRound / LoopJudgeResultPath / LoopHistoryPath) - pipeline/prompts: 新增 buildLoopJudgePrompt ### CI 自动化 - 新增 .github/workflows/ci.yml: push/PR 触发时运行 build + test + lint ## 测试结果 - go test -race ./... 全部 6 个包测试通过 (27/27)
问题: golangci-lint v1.64.8 严格校验 schema,ignored-numbers 需为数组 修复: 字符串改为 YAML 数组;checkout@v4→v5 避免 Node 20 弃用警告
- goimports: 修正 config.go 和 prompts.go 的格式化 - funlen: 从 runCLI 抽出 usageError 和 reportDispatchResult 辅助函数 - gocyclo: 从 runCodingReviewLoop 抽出 runLoopJudgeIfNeeded 降低复杂度
抽出 appendAndSaveHistory 和 checkReviewTerminal 辅助方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
修复测试编译错误
之前
main_test.go、loop_judge_test.go、runner_test.go、config_test.go四个测试文件引用了不存在的类型、常量、函数和接口,导致无法编译。本次提交补齐了对应的实现。生产代码补全
TaskKindLoopJudge任务阶段LoopJudgeAgent/LoopJudgeStartRound/MaxCodingReviewRounds字段及默认常量LoopJudgeResult结构体与loadLoopJudgeResult()校验Runner接口解耦Service与具体实现;将价值评估员接入 coder-reviewer loop;新增shouldRunLoopJudge()/runLoopJudgeRound()/buildLoopJudgeFeedback()EnsureRoundDir/CodingResultPathForRound/ReviewResultPathForRound/LoopJudgeResultPath/LoopHistoryPath)buildLoopJudgePrompt()dispatchService接口和runCLI()函数,重构main()委托给它,使 CLI 逻辑可独立测试CI 自动化
新增
.github/workflows/ci.yml:main/master或针对它们的 PRgo.mod同步 → 编译 → 单元测试 (-race) → golangci-lint 静态分析build/test目标,保持本地与 CI 行为一致关键设计决策
Runner接口 替换*agent.Runner:遵循 Go "accept interfaces" 惯例,最小改动让测试 mock (*scriptedRunner) 可注入ForRound后缀 避免与现有无参方法冲突:Go 不支持方法重载,保留原CodingResultPath()兼容生产代码io.Writer作为runCLI的输出参数:允许*bytes.Buffer(测试) 和*os.File(生产) 同时复用测试结果
go test -race ./...全部 6 个包测试通过 (27/27)关联
本 PR 接续了 Issue #4 的角色分工与流程图,并落地了价值评估员的实现与自动化测试基础设施。